const { defineConfig } = require('@vue/cli-service')
// 用于配置ElementPlus自动导入和自动注册组件
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')
const path = require('path')
module.exports = defineConfig({
  transpileDependencies: true,
  configureWebpack: {
    resolve: {
      alias: {
        'vue$': 'vue/dist/vue.esm-bundler.js',
        '@': path.resolve(__dirname, 'src')
      }
    },
    plugins: [
      AutoImport({
        resolvers: [ElementPlusResolver()],
      }),
      Components({
        // 确保包含所有组件目录
        dirs: ['src/components', 'src/components/*','src/views/*'],
        // 启用子目录搜索
        deep: true,
        // 处理子目录中的 index.vue 文件
        directoryAsNamespace: true,
        // 生成类型声明
        dts: true
      }),
    ],
  },
  
  // 关闭 ESLint 检查
  lintOnSave: false
})
